﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity.ModelConfiguration;
using Sahit.iSoilHotel.Domain.MainBoundedContext.Tavern.Aggregates.AuthenticationAgg;

namespace Sahit.iSoilHotel.Infrastructure.DataAccess.MainBoundedContext.Tavern.Mapping.Accounts
{
    public class PemissionMap : EntityTypeConfiguration<Permission>
    {
        public PemissionMap()
        {
            this.ToTable("Permission");
            this.HasKey(c => c.ID);
            this.Property(u => u.Name).HasMaxLength(50);
            this.Property(ca => ca.Category).HasMaxLength(50);

            this.HasMany(pr => pr.AccountRoles).WithMany(r => r.Permissions).Map(m => m.ToTable("Permission_Role_Mapping"));
        }
    }
}
